'use strict';

module.exports = app => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;

  const MenuSchema = new Schema({
    username: String,
  });

  MenuSchema.pre('save', function(next) {
    this.ids = `${this.Menu}_${this.Menu.substring(5)}`;
    next();
  });
  return mongoose.model('menu', MenuSchema, null, { cache: false });
};
